/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// ptxtthng.hpp - PegTextThing class definition.
//
// Author: Kenneth G. Maxwell
//
// Copyright (c) 1997-2000 Swell Software 
//              All Rights Reserved.
//
// Unauthorized redistribution of this source code, in whole or part,
// without the express written permission of Swell Software
// is strictly prohibited.
//
// Notes:
//
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/

#ifndef _PEGTEXTTHING_
#define _PEGTEXTTHING_

/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
class PegTextThing : public PegThing
{
    public:

        PegTextThing(const PegRect &Rect, PEGUINT StringId = 0,
            PEGUSHORT Id = 0, PEGULONG Style = FF_NONE,
            PEGUINT FontIndex = 0);

        PegTextThing(const PEGCHAR *pText, const PegRect &Rect, 
            PEGUSHORT Id = 0, PEGULONG Style = TT_COPY|FF_NONE,
            PEGUINT FontIndex = 0);

        PegTextThing(PEGUINT StringId, PEGUSHORT Id,
            PEGULONG Style = FF_NONE, PEGUINT FontIndex = 0);

        PegTextThing(const PEGCHAR *pText, PEGUSHORT Id,
            PEGULONG Style = TT_COPY|FF_NONE, PEGUINT FontIndex = 0);

        PegTextThing(PEGULONG Style = TT_COPY|FF_NONE);

        virtual ~PegTextThing();

        const PEGCHAR *DataGet(void) {return mpText;}

       #ifdef PEG_UTF8_ENCODING
        PEGBOOL DataGetUtf8(PEGUBYTE **pPutStr);
       #endif

        void DataClear(void) {DataSet((const PEGCHAR *) NULL);}
        virtual void DataSet(PEGUINT StringId);
        virtual void DataSet(const PEGCHAR *Text);

       #ifdef PEG_UTF8_ENCODING
        void DataSetUtf8(PEGUBYTE *pGet);
       #endif
        
        const PegFont *GetFont(void) {return mpFont;}
        PEGUINT GetFontId(void) {return mFontId;}
       
        PEGUINT GetStringId(void) {return mStringId;}

        void TextThingInit(PEGULONG Style, PEGUINT StringId,
                        const PEGCHAR *pText, PEGUINT FontIndex);
       
        virtual PEGINT Message(const PegMessage &Mesg);
      
        virtual PEGINT RangeCheck(PEGINT Min, PEGINT Max, PEGINT Def);

        void SetCopyMode(void);

        virtual void SetFont(PEGUINT FontIndex);

        PEGINT TextLength(void) {return mStrLen;}

    protected:

        const PegFont *mpFont;
        PEGCHAR *mpText;
        PEGUINT mFontId;
        PEGINT mStrLen;
        PEGINT mBufferLen;
        PEGBOOL mCopy;

    private:
      
        PEGUINT mStringId;

};


#endif  // sentry


